package routes

import (
	"github.com/gin-gonic/gin"
	"learn/app/controllers/home/BaseUserController"
	"learn/routes/middlewares"
)

func ReginRoute(route *gin.Engine) {

	r := route.Group("/v1")
	r.Use(middlewares.Cors()) //跨域中间件
	{

		r.Any("login", func(c *gin.Context) {
			c.AbortWithStatusJSON(200, gin.H{"data": "2222"})
		})
		authority := r.Group("/baseUser")

		baseUser := new(BaseUserController.User)
		authority.POST("userAdd", baseUser.Add)
		authority.POST("userUpdate", baseUser.Update)
		authority.POST("userList", baseUser.List)
		authority.POST("userDel", baseUser.Del)

		authority.POST("login", baseUser.Del)

		baseRole := new(BaseUserController.Role)
		authority.POST("roleAdd", baseRole.Add)
		authority.POST("roleUpdate", baseRole.Update)
		authority.POST("roleList", baseRole.List)
		authority.POST("roleDel", baseRole.Del)

		baseMenu := new(BaseUserController.Menu)
		authority.POST("menuAdd", baseMenu.Add)
		authority.POST("menuUpdate", baseMenu.Update)
		authority.POST("menuList", baseMenu.List)
		authority.POST("menuDel", baseMenu.Del)

		baseUserRole := new(BaseUserController.UserRoles)
		authority.POST("UserRoleAdd", baseUserRole.Update)

		baseRoleMenu := new(BaseUserController.RoleMenu)
		authority.POST("roleMenuAdd", baseRoleMenu.Update)

	}

}
